<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Coverage for c:\program files\python26\lib\unittest</title>
<link rel='stylesheet' href='style.css' type='text/css'>
<script type='text/javascript' src='jquery-1.3.2.min.js'></script>
<script type='text/javascript'>
function toggle_lines(btn, cls) {
    var btn = $(btn);
    var hide = "hide_"+cls;
    if (btn.hasClass(hide)) {
        $("#source ."+cls).removeClass(hide);
        btn.removeClass(hide);
    }
    else {
        $("#source ."+cls).addClass(hide);
        btn.addClass(hide);
    }
}
</script>
</head>
<body>
<div id='header'>
    <div class='content'>
        <h1>Coverage for <b>c:\program files\python26\lib\unittest</b> :
            <span class='pc_cov'>51%</span>
        </h1>
        <h2 class='stats'>
            466 statements
            <span class='run hide_run' onclick='toggle_lines(this, "run")'>268 run</span>
            <span class='exc' onclick='toggle_lines(this, "exc")'>0 excluded</span>
            <span class='mis' onclick='toggle_lines(this, "mis")'>198 missing</span>
            
                <span class='par run hide_run' onclick='toggle_lines(this, "par")'>24 partial</span>
            
        </h2>
    </div>
</div>

<div id='source'>
<table cellspacing='0' cellpadding='0'>
<tr>
<td class='linenos' valign='top'>
<p class='pln'>1</p>
<p class='stm run hide_run'>2</p>
<p class='pln'>3</p>
<p class='pln'>4</p>
<p class='pln'>5</p>
<p class='pln'>6</p>
<p class='pln'>7</p>
<p class='pln'>8</p>
<p class='pln'>9</p>
<p class='pln'>10</p>
<p class='pln'>11</p>
<p class='pln'>12</p>
<p class='pln'>13</p>
<p class='pln'>14</p>
<p class='pln'>15</p>
<p class='pln'>16</p>
<p class='pln'>17</p>
<p class='pln'>18</p>
<p class='pln'>19</p>
<p class='pln'>20</p>
<p class='pln'>21</p>
<p class='pln'>22</p>
<p class='pln'>23</p>
<p class='pln'>24</p>
<p class='pln'>25</p>
<p class='pln'>26</p>
<p class='pln'>27</p>
<p class='pln'>28</p>
<p class='pln'>29</p>
<p class='pln'>30</p>
<p class='pln'>31</p>
<p class='pln'>32</p>
<p class='pln'>33</p>
<p class='pln'>34</p>
<p class='pln'>35</p>
<p class='pln'>36</p>
<p class='pln'>37</p>
<p class='pln'>38</p>
<p class='pln'>39</p>
<p class='pln'>40</p>
<p class='pln'>41</p>
<p class='pln'>42</p>
<p class='pln'>43</p>
<p class='pln'>44</p>
<p class='pln'>45</p>
<p class='pln'>46</p>
<p class='stm run hide_run'>47</p>
<p class='stm run hide_run'>48</p>
<p class='stm run hide_run'>49</p>
<p class='pln'>50</p>
<p class='stm run hide_run'>51</p>
<p class='stm run hide_run'>52</p>
<p class='stm run hide_run'>53</p>
<p class='stm run hide_run'>54</p>
<p class='stm run hide_run'>55</p>
<p class='pln'>56</p>
<p class='pln'>57</p>
<p class='pln'>58</p>
<p class='pln'>59</p>
<p class='stm run hide_run'>60</p>
<p class='pln'>61</p>
<p class='pln'>62</p>
<p class='pln'>63</p>
<p class='stm run hide_run'>64</p>
<p class='pln'>65</p>
<p class='pln'>66</p>
<p class='pln'>67</p>
<p class='pln'>68</p>
<p class='pln'>69</p>
<p class='stm par run hide_run'>70</p>
<p class='stm mis'>71</p>
<p class='stm mis'>72</p>
<p class='stm mis'>73</p>
<p class='stm mis'>74</p>
<p class='stm mis'>75</p>
<p class='stm mis'>76</p>
<p class='stm mis'>77</p>
<p class='stm mis'>78</p>
<p class='stm mis'>79</p>
<p class='pln'>80</p>
<p class='stm run hide_run'>81</p>
<p class='pln'>82</p>
<p class='stm run hide_run'>83</p>
<p class='stm run hide_run'>84</p>
<p class='stm run hide_run'>85</p>
<p class='stm run hide_run'>86</p>
<p class='stm run hide_run'>87</p>
<p class='stm run hide_run'>88</p>
<p class='pln'>89</p>
<p class='pln'>90</p>
<p class='pln'>91</p>
<p class='pln'>92</p>
<p class='pln'>93</p>
<p class='pln'>94</p>
<p class='stm run hide_run'>95</p>
<p class='pln'>96</p>
<p class='stm run hide_run'>97</p>
<p class='stm mis'>98</p>
<p class='pln'>99</p>
<p class='stm run hide_run'>100</p>
<p class='pln'>101</p>
<p class='stm run hide_run'>102</p>
<p class='pln'>103</p>
<p class='pln'>104</p>
<p class='pln'>105</p>
<p class='pln'>106</p>
<p class='pln'>107</p>
<p class='pln'>108</p>
<p class='pln'>109</p>
<p class='pln'>110</p>
<p class='pln'>111</p>
<p class='pln'>112</p>
<p class='stm run hide_run'>113</p>
<p class='stm run hide_run'>114</p>
<p class='stm run hide_run'>115</p>
<p class='stm run hide_run'>116</p>
<p class='stm run hide_run'>117</p>
<p class='pln'>118</p>
<p class='stm run hide_run'>119</p>
<p class='pln'>120</p>
<p class='stm run hide_run'>121</p>
<p class='pln'>122</p>
<p class='stm run hide_run'>123</p>
<p class='pln'>124</p>
<p class='stm run hide_run'>125</p>
<p class='pln'>126</p>
<p class='stm run hide_run'>127</p>
<p class='pln'>128</p>
<p class='pln'>129</p>
<p class='pln'>130</p>
<p class='stm mis'>131</p>
<p class='pln'>132</p>
<p class='stm run hide_run'>133</p>
<p class='pln'>134</p>
<p class='pln'>135</p>
<p class='stm mis'>136</p>
<p class='pln'>137</p>
<p class='stm run hide_run'>138</p>
<p class='pln'>139</p>
<p class='stm run hide_run'>140</p>
<p class='pln'>141</p>
<p class='stm run hide_run'>142</p>
<p class='pln'>143</p>
<p class='stm run hide_run'>144</p>
<p class='pln'>145</p>
<p class='stm run hide_run'>146</p>
<p class='pln'>147</p>
<p class='stm mis'>148</p>
<p class='pln'>149</p>
<p class='stm run hide_run'>150</p>
<p class='pln'>151</p>
<p class='stm mis'>152</p>
<p class='pln'>153</p>
<p class='stm mis'>154</p>
<p class='stm mis'>155</p>
<p class='stm mis'>156</p>
<p class='pln'>157</p>
<p class='stm mis'>158</p>
<p class='stm mis'>159</p>
<p class='stm mis'>160</p>
<p class='pln'>161</p>
<p class='stm run hide_run'>162</p>
<p class='stm mis'>163</p>
<p class='pln'>164</p>
<p class='stm run hide_run'>165</p>
<p class='stm mis'>166</p>
<p class='stm mis'>167</p>
<p class='stm mis'>168</p>
<p class='stm mis'>169</p>
<p class='stm mis'>170</p>
<p class='pln'>171</p>
<p class='stm run hide_run'>172</p>
<p class='stm mis'>173</p>
<p class='pln'>174</p>
<p class='pln'>175</p>
<p class='pln'>176</p>
<p class='stm run hide_run'>177</p>
<p class='pln'>178</p>
<p class='pln'>179</p>
<p class='pln'>180</p>
<p class='pln'>181</p>
<p class='pln'>182</p>
<p class='pln'>183</p>
<p class='pln'>184</p>
<p class='pln'>185</p>
<p class='pln'>186</p>
<p class='pln'>187</p>
<p class='pln'>188</p>
<p class='pln'>189</p>
<p class='pln'>190</p>
<p class='pln'>191</p>
<p class='pln'>192</p>
<p class='pln'>193</p>
<p class='pln'>194</p>
<p class='pln'>195</p>
<p class='pln'>196</p>
<p class='pln'>197</p>
<p class='pln'>198</p>
<p class='pln'>199</p>
<p class='pln'>200</p>
<p class='pln'>201</p>
<p class='pln'>202</p>
<p class='stm run hide_run'>203</p>
<p class='pln'>204</p>
<p class='stm run hide_run'>205</p>
<p class='pln'>206</p>
<p class='pln'>207</p>
<p class='pln'>208</p>
<p class='pln'>209</p>
<p class='stm run hide_run'>210</p>
<p class='stm run hide_run'>211</p>
<p class='stm run hide_run'>212</p>
<p class='stm run hide_run'>213</p>
<p class='stm mis'>214</p>
<p class='stm mis'>215</p>
<p class='pln'>216</p>
<p class='pln'>217</p>
<p class='stm run hide_run'>218</p>
<p class='pln'>219</p>
<p class='stm mis'>220</p>
<p class='pln'>221</p>
<p class='stm run hide_run'>222</p>
<p class='pln'>223</p>
<p class='stm mis'>224</p>
<p class='pln'>225</p>
<p class='stm run hide_run'>226</p>
<p class='stm mis'>227</p>
<p class='pln'>228</p>
<p class='stm run hide_run'>229</p>
<p class='stm mis'>230</p>
<p class='pln'>231</p>
<p class='stm run hide_run'>232</p>
<p class='pln'>233</p>
<p class='pln'>234</p>
<p class='pln'>235</p>
<p class='pln'>236</p>
<p class='pln'>237</p>
<p class='pln'>238</p>
<p class='stm run hide_run'>239</p>
<p class='stm run hide_run'>240</p>
<p class='pln'>241</p>
<p class='stm run hide_run'>242</p>
<p class='stm mis'>243</p>
<p class='pln'>244</p>
<p class='stm run hide_run'>245</p>
<p class='stm mis'>246</p>
<p class='stm mis'>247</p>
<p class='pln'>248</p>
<p class='stm mis'>249</p>
<p class='pln'>250</p>
<p class='stm run hide_run'>251</p>
<p class='stm mis'>252</p>
<p class='pln'>253</p>
<p class='stm run hide_run'>254</p>
<p class='stm mis'>255</p>
<p class='pln'>256</p>
<p class='stm run hide_run'>257</p>
<p class='stm mis'>258</p>
<p class='pln'>259</p>
<p class='stm run hide_run'>260</p>
<p class='stm mis'>261</p>
<p class='pln'>262</p>
<p class='pln'>263</p>
<p class='stm run hide_run'>264</p>
<p class='stm run hide_run'>265</p>
<p class='stm run hide_run'>266</p>
<p class='stm run hide_run'>267</p>
<p class='stm run hide_run'>268</p>
<p class='stm run hide_run'>269</p>
<p class='stm run hide_run'>270</p>
<p class='stm mis'>271</p>
<p class='stm mis'>272</p>
<p class='stm mis'>273</p>
<p class='stm mis'>274</p>
<p class='stm mis'>275</p>
<p class='pln'>276</p>
<p class='stm run hide_run'>277</p>
<p class='stm run hide_run'>278</p>
<p class='stm run hide_run'>279</p>
<p class='stm run hide_run'>280</p>
<p class='stm mis'>281</p>
<p class='stm mis'>282</p>
<p class='stm mis'>283</p>
<p class='stm mis'>284</p>
<p class='stm mis'>285</p>
<p class='stm mis'>286</p>
<p class='pln'>287</p>
<p class='stm run hide_run'>288</p>
<p class='stm run hide_run'>289</p>
<p class='stm mis'>290</p>
<p class='stm mis'>291</p>
<p class='stm mis'>292</p>
<p class='stm mis'>293</p>
<p class='stm mis'>294</p>
<p class='stm run hide_run'>295</p>
<p class='pln'>296</p>
<p class='stm run hide_run'>297</p>
<p class='pln'>298</p>
<p class='stm run hide_run'>299</p>
<p class='stm run hide_run'>300</p>
<p class='pln'>301</p>
<p class='stm run hide_run'>302</p>
<p class='pln'>303</p>
<p class='stm mis'>304</p>
<p class='stm mis'>305</p>
<p class='stm mis'>306</p>
<p class='pln'>307</p>
<p class='stm run hide_run'>308</p>
<p class='pln'>309</p>
<p class='pln'>310</p>
<p class='pln'>311</p>
<p class='pln'>312</p>
<p class='stm mis'>313</p>
<p class='pln'>314</p>
<p class='stm run hide_run'>315</p>
<p class='pln'>316</p>
<p class='stm mis'>317</p>
<p class='pln'>318</p>
<p class='stm run hide_run'>319</p>
<p class='pln'>320</p>
<p class='stm mis'>321</p>
<p class='pln'>322</p>
<p class='stm run hide_run'>323</p>
<p class='pln'>324</p>
<p class='stm run hide_run'>325</p>
<p class='pln'>326</p>
<p class='stm run hide_run'>327</p>
<p class='pln'>328</p>
<p class='pln'>329</p>
<p class='pln'>330</p>
<p class='pln'>331</p>
<p class='pln'>332</p>
<p class='pln'>333</p>
<p class='pln'>334</p>
<p class='stm run hide_run'>335</p>
<p class='stm run hide_run'>336</p>
<p class='stm run hide_run'>337</p>
<p class='stm run hide_run'>338</p>
<p class='pln'>339</p>
<p class='stm mis'>340</p>
<p class='stm mis'>341</p>
<p class='stm mis'>342</p>
<p class='pln'>343</p>
<p class='stm run hide_run'>344</p>
<p class='pln'>345</p>
<p class='pln'>346</p>
<p class='pln'>347</p>
<p class='stm par run hide_run'>348</p>
<p class='stm mis'>349</p>
<p class='pln'>350</p>
<p class='pln'>351</p>
<p class='stm run hide_run'>352</p>
<p class='pln'>353</p>
<p class='pln'>354</p>
<p class='pln'>355</p>
<p class='stm mis'>356</p>
<p class='stm mis'>357</p>
<p class='pln'>358</p>
<p class='pln'>359</p>
<p class='stm run hide_run'>360</p>
<p class='pln'>361</p>
<p class='pln'>362</p>
<p class='pln'>363</p>
<p class='pln'>364</p>
<p class='pln'>365</p>
<p class='pln'>366</p>
<p class='pln'>367</p>
<p class='stm mis'>368</p>
<p class='stm mis'>369</p>
<p class='pln'>370</p>
<p class='pln'>371</p>
<p class='stm run hide_run'>372</p>
<p class='pln'>373</p>
<p class='pln'>374</p>
<p class='pln'>375</p>
<p class='pln'>376</p>
<p class='pln'>377</p>
<p class='pln'>378</p>
<p class='pln'>379</p>
<p class='stm mis'>380</p>
<p class='stm mis'>381</p>
<p class='pln'>382</p>
<p class='pln'>383</p>
<p class='pln'>384</p>
<p class='pln'>385</p>
<p class='stm run hide_run'>386</p>
<p class='pln'>387</p>
<p class='stm run hide_run'>388</p>
<p class='pln'>389</p>
<p class='stm run hide_run'>390</p>
<p class='pln'>391</p>
<p class='stm run hide_run'>392</p>
<p class='pln'>393</p>
<p class='stm run hide_run'>394</p>
<p class='pln'>395</p>
<p class='stm run hide_run'>396</p>
<p class='pln'>397</p>
<p class='stm run hide_run'>398</p>
<p class='pln'>399</p>
<p class='pln'>400</p>
<p class='pln'>401</p>
<p class='stm run hide_run'>402</p>
<p class='pln'>403</p>
<p class='pln'>404</p>
<p class='pln'>405</p>
<p class='pln'>406</p>
<p class='pln'>407</p>
<p class='pln'>408</p>
<p class='pln'>409</p>
<p class='pln'>410</p>
<p class='stm run hide_run'>411</p>
<p class='stm run hide_run'>412</p>
<p class='stm run hide_run'>413</p>
<p class='pln'>414</p>
<p class='stm run hide_run'>415</p>
<p class='stm mis'>416</p>
<p class='pln'>417</p>
<p class='stm run hide_run'>418</p>
<p class='pln'>419</p>
<p class='stm run hide_run'>420</p>
<p class='stm mis'>421</p>
<p class='stm mis'>422</p>
<p class='stm mis'>423</p>
<p class='pln'>424</p>
<p class='stm run hide_run'>425</p>
<p class='stm mis'>426</p>
<p class='pln'>427</p>
<p class='pln'>428</p>
<p class='stm run hide_run'>429</p>
<p class='pln'>430</p>
<p class='stm run hide_run'>431</p>
<p class='stm mis'>432</p>
<p class='pln'>433</p>
<p class='stm run hide_run'>434</p>
<p class='stm mis'>435</p>
<p class='stm mis'>436</p>
<p class='stm mis'>437</p>
<p class='stm mis'>438</p>
<p class='pln'>439</p>
<p class='stm run hide_run'>440</p>
<p class='pln'>441</p>
<p class='stm par run hide_run'>442</p>
<p class='stm mis'>443</p>
<p class='stm par run hide_run'>444</p>
<p class='pln'>445</p>
<p class='stm mis'>446</p>
<p class='pln'>447</p>
<p class='stm run hide_run'>448</p>
<p class='pln'>449</p>
<p class='stm run hide_run'>450</p>
<p class='stm par run hide_run'>451</p>
<p class='stm mis'>452</p>
<p class='stm run hide_run'>453</p>
<p class='stm run hide_run'>454</p>
<p class='pln'>455</p>
<p class='stm run hide_run'>456</p>
<p class='stm run hide_run'>457</p>
<p class='stm par run hide_run'>458</p>
<p class='stm mis'>459</p>
<p class='stm run hide_run'>460</p>
<p class='stm run hide_run'>461</p>
<p class='pln'>462</p>
<p class='stm run hide_run'>463</p>
<p class='stm run hide_run'>464</p>
<p class='pln'>465</p>
<p class='stm run hide_run'>466</p>
<p class='pln'>467</p>
<p class='stm mis'>468</p>
<p class='pln'>469</p>
<p class='pln'>470</p>
<p class='stm run hide_run'>471</p>
<p class='pln'>472</p>
<p class='pln'>473</p>
<p class='pln'>474</p>
<p class='pln'>475</p>
<p class='pln'>476</p>
<p class='pln'>477</p>
<p class='pln'>478</p>
<p class='pln'>479</p>
<p class='stm run hide_run'>480</p>
<p class='pln'>481</p>
<p class='stm mis'>482</p>
<p class='stm mis'>483</p>
<p class='stm mis'>484</p>
<p class='stm mis'>485</p>
<p class='stm mis'>486</p>
<p class='pln'>487</p>
<p class='stm run hide_run'>488</p>
<p class='stm mis'>489</p>
<p class='stm mis'>490</p>
<p class='pln'>491</p>
<p class='stm run hide_run'>492</p>
<p class='stm mis'>493</p>
<p class='stm mis'>494</p>
<p class='pln'>495</p>
<p class='stm run hide_run'>496</p>
<p class='stm mis'>497</p>
<p class='pln'>498</p>
<p class='stm run hide_run'>499</p>
<p class='stm mis'>500</p>
<p class='pln'>501</p>
<p class='stm run hide_run'>502</p>
<p class='stm mis'>503</p>
<p class='stm mis'>504</p>
<p class='pln'>505</p>
<p class='stm mis'>506</p>
<p class='pln'>507</p>
<p class='pln'>508</p>
<p class='pln'>509</p>
<p class='pln'>510</p>
<p class='stm run hide_run'>511</p>
<p class='stm mis'>512</p>
<p class='pln'>513</p>
<p class='stm run hide_run'>514</p>
<p class='stm mis'>515</p>
<p class='pln'>516</p>
<p class='pln'>517</p>
<p class='stm run hide_run'>518</p>
<p class='stm mis'>519</p>
<p class='pln'>520</p>
<p class='stm run hide_run'>521</p>
<p class='stm mis'>522</p>
<p class='pln'>523</p>
<p class='stm run hide_run'>524</p>
<p class='stm mis'>525</p>
<p class='stm mis'>526</p>
<p class='stm mis'>527</p>
<p class='pln'>528</p>
<p class='pln'>529</p>
<p class='pln'>530</p>
<p class='pln'>531</p>
<p class='pln'>532</p>
<p class='pln'>533</p>
<p class='pln'>534</p>
<p class='stm run hide_run'>535</p>
<p class='pln'>536</p>
<p class='pln'>537</p>
<p class='pln'>538</p>
<p class='stm run hide_run'>539</p>
<p class='stm run hide_run'>540</p>
<p class='stm run hide_run'>541</p>
<p class='pln'>542</p>
<p class='stm run hide_run'>543</p>
<p class='pln'>544</p>
<p class='stm par run hide_run'>545</p>
<p class='stm mis'>546</p>
<p class='stm run hide_run'>547</p>
<p class='stm par run hide_run'>548</p>
<p class='stm mis'>549</p>
<p class='stm run hide_run'>550</p>
<p class='pln'>551</p>
<p class='stm run hide_run'>552</p>
<p class='pln'>553</p>
<p class='stm run hide_run'>554</p>
<p class='stm run hide_run'>555</p>
<p class='stm run hide_run'>556</p>
<p class='stm run hide_run'>557</p>
<p class='pln'>558</p>
<p class='stm run hide_run'>559</p>
<p class='stm run hide_run'>560</p>
<p class='pln'>561</p>
<p class='stm run hide_run'>562</p>
<p class='pln'>563</p>
<p class='pln'>564</p>
<p class='pln'>565</p>
<p class='pln'>566</p>
<p class='pln'>567</p>
<p class='pln'>568</p>
<p class='pln'>569</p>
<p class='pln'>570</p>
<p class='stm mis'>571</p>
<p class='stm mis'>572</p>
<p class='stm mis'>573</p>
<p class='stm mis'>574</p>
<p class='stm mis'>575</p>
<p class='stm mis'>576</p>
<p class='stm mis'>577</p>
<p class='stm mis'>578</p>
<p class='stm mis'>579</p>
<p class='stm mis'>580</p>
<p class='stm mis'>581</p>
<p class='stm mis'>582</p>
<p class='stm mis'>583</p>
<p class='stm mis'>584</p>
<p class='pln'>585</p>
<p class='stm mis'>586</p>
<p class='stm mis'>587</p>
<p class='stm mis'>588</p>
<p class='pln'>589</p>
<p class='stm mis'>590</p>
<p class='stm mis'>591</p>
<p class='pln'>592</p>
<p class='pln'>593</p>
<p class='stm mis'>594</p>
<p class='stm mis'>595</p>
<p class='stm mis'>596</p>
<p class='stm mis'>597</p>
<p class='stm mis'>598</p>
<p class='stm mis'>599</p>
<p class='stm mis'>600</p>
<p class='stm mis'>601</p>
<p class='stm mis'>602</p>
<p class='pln'>603</p>
<p class='stm mis'>604</p>
<p class='pln'>605</p>
<p class='pln'>606</p>
<p class='stm mis'>607</p>
<p class='pln'>608</p>
<p class='stm run hide_run'>609</p>
<p class='pln'>610</p>
<p class='pln'>611</p>
<p class='pln'>612</p>
<p class='stm mis'>613</p>
<p class='stm mis'>614</p>
<p class='pln'>615</p>
<p class='stm run hide_run'>616</p>
<p class='pln'>617</p>
<p class='pln'>618</p>
<p class='stm run hide_run'>619</p>
<p class='stm run hide_run'>620</p>
<p class='stm run hide_run'>621</p>
<p class='stm par run hide_run'>622</p>
<p class='stm run hide_run'>623</p>
<p class='stm run hide_run'>624</p>
<p class='pln'>625</p>
<p class='pln'>626</p>
<p class='pln'>627</p>
<p class='stm run hide_run'>628</p>
<p class='pln'>629</p>
<p class='pln'>630</p>
<p class='pln'>631</p>
<p class='pln'>632</p>
<p class='pln'>633</p>
<p class='pln'>634</p>
<p class='stm run hide_run'>635</p>
<p class='stm mis'>636</p>
<p class='stm mis'>637</p>
<p class='stm mis'>638</p>
<p class='stm mis'>639</p>
<p class='stm mis'>640</p>
<p class='pln'>641</p>
<p class='stm run hide_run'>642</p>
<p class='stm mis'>643</p>
<p class='pln'>644</p>
<p class='stm run hide_run'>645</p>
<p class='stm mis'>646</p>
<p class='pln'>647</p>
<p class='stm run hide_run'>648</p>
<p class='stm mis'>649</p>
<p class='pln'>650</p>
<p class='pln'>651</p>
<p class='pln'>652</p>
<p class='pln'>653</p>
<p class='pln'>654</p>
<p class='pln'>655</p>
<p class='stm run hide_run'>656</p>
<p class='pln'>657</p>
<p class='stm run hide_run'>658</p>
<p class='stm run hide_run'>659</p>
<p class='pln'>660</p>
<p class='stm run hide_run'>661</p>
<p class='stm run hide_run'>662</p>
<p class='pln'>663</p>
<p class='stm run hide_run'>664</p>
<p class='stm run hide_run'>665</p>
<p class='stm run hide_run'>666</p>
<p class='pln'>667</p>
<p class='pln'>668</p>
<p class='stm run hide_run'>669</p>
<p class='pln'>670</p>
<p class='pln'>671</p>
<p class='pln'>672</p>
<p class='pln'>673</p>
<p class='stm run hide_run'>674</p>
<p class='stm run hide_run'>675</p>
<p class='pln'>676</p>
<p class='stm run hide_run'>677</p>
<p class='stm run hide_run'>678</p>
<p class='stm run hide_run'>679</p>
<p class='stm run hide_run'>680</p>
<p class='stm run hide_run'>681</p>
<p class='stm run hide_run'>682</p>
<p class='pln'>683</p>
<p class='stm run hide_run'>684</p>
<p class='stm par run hide_run'>685</p>
<p class='stm run hide_run'>686</p>
<p class='pln'>687</p>
<p class='stm mis'>688</p>
<p class='pln'>689</p>
<p class='stm run hide_run'>690</p>
<p class='stm run hide_run'>691</p>
<p class='stm par run hide_run'>692</p>
<p class='stm run hide_run'>693</p>
<p class='stm run hide_run'>694</p>
<p class='stm run hide_run'>695</p>
<p class='pln'>696</p>
<p class='stm run hide_run'>697</p>
<p class='stm run hide_run'>698</p>
<p class='stm par run hide_run'>699</p>
<p class='stm run hide_run'>700</p>
<p class='stm mis'>701</p>
<p class='stm mis'>702</p>
<p class='stm mis'>703</p>
<p class='pln'>704</p>
<p class='stm run hide_run'>705</p>
<p class='stm mis'>706</p>
<p class='stm mis'>707</p>
<p class='stm mis'>708</p>
<p class='stm mis'>709</p>
<p class='stm mis'>710</p>
<p class='stm mis'>711</p>
<p class='pln'>712</p>
<p class='stm run hide_run'>713</p>
<p class='stm mis'>714</p>
<p class='stm mis'>715</p>
<p class='stm mis'>716</p>
<p class='stm mis'>717</p>
<p class='stm mis'>718</p>
<p class='stm mis'>719</p>
<p class='pln'>720</p>
<p class='stm run hide_run'>721</p>
<p class='stm par run hide_run'>722</p>
<p class='stm run hide_run'>723</p>
<p class='stm run hide_run'>724</p>
<p class='stm run hide_run'>725</p>
<p class='pln'>726</p>
<p class='stm run hide_run'>727</p>
<p class='stm par run hide_run'>728</p>
<p class='stm mis'>729</p>
<p class='stm mis'>730</p>
<p class='stm mis'>731</p>
<p class='stm mis'>732</p>
<p class='pln'>733</p>
<p class='pln'>734</p>
<p class='stm run hide_run'>735</p>
<p class='pln'>736</p>
<p class='pln'>737</p>
<p class='pln'>738</p>
<p class='pln'>739</p>
<p class='pln'>740</p>
<p class='stm run hide_run'>741</p>
<p class='stm run hide_run'>742</p>
<p class='stm run hide_run'>743</p>
<p class='stm run hide_run'>744</p>
<p class='pln'>745</p>
<p class='stm run hide_run'>746</p>
<p class='stm run hide_run'>747</p>
<p class='pln'>748</p>
<p class='stm run hide_run'>749</p>
<p class='pln'>750</p>
<p class='stm run hide_run'>751</p>
<p class='stm run hide_run'>752</p>
<p class='stm run hide_run'>753</p>
<p class='stm run hide_run'>754</p>
<p class='stm run hide_run'>755</p>
<p class='stm run hide_run'>756</p>
<p class='stm run hide_run'>757</p>
<p class='stm run hide_run'>758</p>
<p class='stm run hide_run'>759</p>
<p class='pln'>760</p>
<p class='stm run hide_run'>761</p>
<p class='stm par run hide_run'>762</p>
<p class='stm mis'>763</p>
<p class='stm mis'>764</p>
<p class='stm mis'>765</p>
<p class='stm mis'>766</p>
<p class='stm mis'>767</p>
<p class='stm mis'>768</p>
<p class='stm mis'>769</p>
<p class='stm mis'>770</p>
<p class='pln'>771</p>
<p class='stm run hide_run'>772</p>
<p class='stm run hide_run'>773</p>
<p class='pln'>774</p>
<p class='pln'>775</p>
<p class='pln'>776</p>
<p class='pln'>777</p>
<p class='pln'>778</p>
<p class='pln'>779</p>
<p class='pln'>780</p>
<p class='stm run hide_run'>781</p>
<p class='pln'>782</p>
<p class='pln'>783</p>
<p class='pln'>784</p>
<p class='stm run hide_run'>785</p>
<p class='pln'>786</p>
<p class='pln'>787</p>
<p class='pln'>788</p>
<p class='pln'>789</p>
<p class='pln'>790</p>
<p class='pln'>791</p>
<p class='pln'>792</p>
<p class='pln'>793</p>
<p class='pln'>794</p>
<p class='pln'>795</p>
<p class='pln'>796</p>
<p class='pln'>797</p>
<p class='pln'>798</p>
<p class='pln'>799</p>
<p class='stm run hide_run'>800</p>
<p class='pln'>801</p>
<p class='pln'>802</p>
<p class='stm par run hide_run'>803</p>
<p class='stm run hide_run'>804</p>
<p class='stm par run hide_run'>805</p>
<p class='stm mis'>806</p>
<p class='pln'>807</p>
<p class='stm mis'>808</p>
<p class='stm par run hide_run'>809</p>
<p class='stm mis'>810</p>
<p class='stm run hide_run'>811</p>
<p class='stm run hide_run'>812</p>
<p class='stm run hide_run'>813</p>
<p class='stm run hide_run'>814</p>
<p class='stm run hide_run'>815</p>
<p class='stm run hide_run'>816</p>
<p class='stm run hide_run'>817</p>
<p class='pln'>818</p>
<p class='stm run hide_run'>819</p>
<p class='stm mis'>820</p>
<p class='stm mis'>821</p>
<p class='stm mis'>822</p>
<p class='pln'>823</p>
<p class='stm run hide_run'>824</p>
<p class='stm run hide_run'>825</p>
<p class='stm run hide_run'>826</p>
<p class='stm run hide_run'>827</p>
<p class='pln'>828</p>
<p class='stm run hide_run'>829</p>
<p class='stm par run hide_run'>830</p>
<p class='stm mis'>831</p>
<p class='stm par run hide_run'>832</p>
<p class='stm mis'>833</p>
<p class='stm par run hide_run'>834</p>
<p class='stm run hide_run'>835</p>
<p class='stm par run hide_run'>836</p>
<p class='stm run hide_run'>837</p>
<p class='stm run hide_run'>838</p>
<p class='stm mis'>839</p>
<p class='stm mis'>840</p>
<p class='pln'>841</p>
<p class='stm mis'>842</p>
<p class='stm mis'>843</p>
<p class='stm mis'>844</p>
<p class='stm mis'>845</p>
<p class='pln'>846</p>
<p class='stm run hide_run'>847</p>
<p class='stm mis'>848</p>
<p class='pln'>849</p>
<p class='pln'>850</p>
<p class='stm run hide_run'>851</p>
<p class='stm par run hide_run'>852</p>
<p class='stm run hide_run'>853</p>
<p class='stm run hide_run'>854</p>
<p class='stm mis'>855</p>
<p class='pln'>856</p>
<p class='stm mis'>857</p>
<p class='pln'>858</p>
<p class='pln'>859</p>
<p class='stm mis'>860</p>
<p class='stm run hide_run'>861</p>
<p class='stm run hide_run'>862</p>
<p class='pln'>863</p>
<p class='stm run hide_run'>864</p>
<p class='pln'>865</p>
<p class='pln'>866</p>
<p class='pln'>867</p>
<p class='pln'>868</p>
<p class='pln'>869</p>
<p class='pln'>870</p>
<p class='stm par run hide_run'>871</p>
<p class='stm mis'>872</p>
    
</td>
<td class='text' valign='top'>
<p class='pln'><span class='com'>#!/usr/bin/env python</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='str'>&#39;&#39;&#39;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>Python unit testing framework, based on Erich Gamma&#39;s JUnit and Kent Beck&#39;s</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>Smalltalk testing framework.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>This module contains the core framework classes that form the basis of</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>specific test cases and suites (TestCase, TestSuite etc.), and also a</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>text-based utility class for running the tests and reporting the results</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'> (TextTestRunner).</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>Simple usage:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; import unittest</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; class IntegerArithmenticTestCase(unittest.TestCase):</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; def testAdd(self):&nbsp; ## test method names begin &#39;test*&#39;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.assertEquals((1 + 2), 3)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.assertEquals(0 + 1, 1)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; def testMultiply(self):</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.assertEquals((0 * 10), 0)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.assertEquals((5 * 8), 40)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; if __name__ == &#39;__main__&#39;:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; unittest.main()</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>Further information is available in the bundled documentation, and from</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; http://docs.python.org/lib/module-unittest.html</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>Copyright (c) 1999-2003 Steve Purcell</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>This module is free software, and you may redistribute it and/or modify</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>it under the same terms as Python itself, so long as this copyright message</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>and disclaimer are retained in their original form.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>DAMAGE.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>PARTICULAR PURPOSE.&nbsp; THE CODE PROVIDED HEREUNDER IS ON AN &quot;AS IS&quot; BASIS,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&#39;&#39;&#39;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>__author__</span> <span class='op'>=</span> <span class='str'>&quot;Steve Purcell&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>__email__</span> <span class='op'>=</span> <span class='str'>&quot;stephen_purcell at yahoo dot com&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>__version__</span> <span class='op'>=</span> <span class='str'>&quot;#Revision: 1.63 $&quot;</span><span class='op'>[</span><span class='num'>11</span><span class='op'>:</span><span class='op'>-</span><span class='num'>2</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>time</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>sys</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>traceback</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>os</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>import</span> <span class='nam'>types</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># Exported classes and functions</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>__all__</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;TestResult&#39;</span><span class='op'>,</span> <span class='str'>&#39;TestCase&#39;</span><span class='op'>,</span> <span class='str'>&#39;TestSuite&#39;</span><span class='op'>,</span> <span class='str'>&#39;TextTestRunner&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;TestLoader&#39;</span><span class='op'>,</span> <span class='str'>&#39;FunctionTestCase&#39;</span><span class='op'>,</span> <span class='str'>&#39;main&#39;</span><span class='op'>,</span> <span class='str'>&#39;defaultTestLoader&#39;</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># Expose obsolete functions for backwards compatibility</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>__all__</span><span class='op'>.</span><span class='nam'>extend</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;getTestCaseNames&#39;</span><span class='op'>,</span> <span class='str'>&#39;makeSuite&#39;</span><span class='op'>,</span> <span class='str'>&#39;findTestCases&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># Backward compatibility</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>71</span><span class='key'>if</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>version_info</span><span class='op'>[</span><span class='op'>:</span><span class='num'>2</span><span class='op'>]</span> <span class='op'>&lt;</span> <span class='op'>(</span><span class='num'>2</span><span class='op'>,</span> <span class='num'>2</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='nam'>clsinfo</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>import</span> <span class='nam'>__builtin__</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>type</span><span class='op'>(</span><span class='nam'>clsinfo</span><span class='op'>)</span> <span class='key'>in</span> <span class='op'>(</span><span class='nam'>tuple</span><span class='op'>,</span> <span class='nam'>list</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>cls</span> <span class='key'>in</span> <span class='nam'>clsinfo</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>cls</span> <span class='key'>is</span> <span class='nam'>type</span><span class='op'>:</span> <span class='nam'>cls</span> <span class='op'>=</span> <span class='nam'>types</span><span class='op'>.</span><span class='nam'>ClassType</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>__builtin__</span><span class='op'>.</span><span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='nam'>cls</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='num'>0</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>__builtin__</span><span class='op'>.</span><span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='nam'>clsinfo</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>_CmpToKey</span><span class='op'>(</span><span class='nam'>mycmp</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Convert a cmp= function into a key= function&#39;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>class</span> <span class='nam'>K</span><span class='op'>(</span><span class='nam'>object</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>obj</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>obj</span> <span class='op'>=</span> <span class='nam'>obj</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__lt__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>mycmp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>obj</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>.</span><span class='nam'>obj</span><span class='op'>)</span> <span class='op'>==</span> <span class='op'>-</span><span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>K</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># Test framework core</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># All classes defined herein are &#39;new-style&#39; classes, allowing use of &#39;super()&#39;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>__metaclass__</span> <span class='op'>=</span> <span class='nam'>type</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>_strclass</span><span class='op'>(</span><span class='nam'>cls</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&quot;%s.%s&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>cls</span><span class='op'>.</span><span class='nam'>__module__</span><span class='op'>,</span> <span class='nam'>cls</span><span class='op'>.</span><span class='nam'>__name__</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>__unittest</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>TestResult</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Holder for test result information.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; Test results are automatically managed by the TestCase and TestSuite</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; classes, and do not need to be explicitly manipulated by writers of tests.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; Each instance holds the total number of tests run, and collections of</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; failures and errors that occurred among those test runs. The collections</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; contain tuples of (testcase, exceptioninfo), where exceptioninfo is the</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; formatted traceback of the error that occurred.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failures</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>errors</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testsRun</span> <span class='op'>=</span> <span class='num'>0</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>shouldStop</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>startTest</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Called when the given test is about to be run&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testsRun</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testsRun</span> <span class='op'>+</span> <span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>stopTest</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Called when the given test has been run&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>pass</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>addError</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Called when an error has occurred. &#39;err&#39; is a tuple of values as</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; returned by sys.exc_info().</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>errors</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_exc_info_to_string</span><span class='op'>(</span><span class='nam'>err</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>addFailure</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Called when an error has occurred. &#39;err&#39; is a tuple of values as</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; returned by sys.exc_info().&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failures</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_exc_info_to_string</span><span class='op'>(</span><span class='nam'>err</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>addSuccess</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Called when a test has completed successfully&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>pass</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>wasSuccessful</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Tells whether or not this result was a success&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>failures</span><span class='op'>)</span> <span class='op'>==</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>errors</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>stop</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Indicates that the tests should be aborted&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>shouldStop</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_exc_info_to_string</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Converts a sys.exc_info()-style tuple of values into a string.&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>exctype</span><span class='op'>,</span> <span class='nam'>value</span><span class='op'>,</span> <span class='nam'>tb</span> <span class='op'>=</span> <span class='nam'>err</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Skip test runner traceback levels</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>tb</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_is_relevant_tb_level</span><span class='op'>(</span><span class='nam'>tb</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>tb</span> <span class='op'>=</span> <span class='nam'>tb</span><span class='op'>.</span><span class='nam'>tb_next</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>exctype</span> <span class='key'>is</span> <span class='nam'>test</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Skip assert*() traceback levels</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>length</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_count_relevant_tb_levels</span><span class='op'>(</span><span class='nam'>tb</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&#39;&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>traceback</span><span class='op'>.</span><span class='nam'>format_exception</span><span class='op'>(</span><span class='nam'>exctype</span><span class='op'>,</span> <span class='nam'>value</span><span class='op'>,</span> <span class='nam'>tb</span><span class='op'>,</span> <span class='nam'>length</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&#39;&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>traceback</span><span class='op'>.</span><span class='nam'>format_exception</span><span class='op'>(</span><span class='nam'>exctype</span><span class='op'>,</span> <span class='nam'>value</span><span class='op'>,</span> <span class='nam'>tb</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_is_relevant_tb_level</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>tb</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&#39;__unittest&#39;</span> <span class='key'>in</span> <span class='nam'>tb</span><span class='op'>.</span><span class='nam'>tb_frame</span><span class='op'>.</span><span class='nam'>f_globals</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_count_relevant_tb_levels</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>tb</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>length</span> <span class='op'>=</span> <span class='num'>0</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>tb</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_is_relevant_tb_level</span><span class='op'>(</span><span class='nam'>tb</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>length</span> <span class='op'>+=</span> <span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>tb</span> <span class='op'>=</span> <span class='nam'>tb</span><span class='op'>.</span><span class='nam'>tb_next</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>length</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__repr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&quot;&lt;%s run=%i errors=%i failures=%i&gt;&quot;</span> <span class='op'>%</span> <span class='xx'>\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='op'>(</span><span class='nam'>_strclass</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>__class__</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testsRun</span><span class='op'>,</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>errors</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>len</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>failures</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>TestCase</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;A class whose instances are single test cases.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; By default, the test code itself should be placed in a method named</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &#39;runTest&#39;.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; If the fixture may be used for many test cases, create as</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; many test methods as are needed. When instantiating such a TestCase</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; subclass, specify in the constructor arguments the name of the test method</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; that the instance is to execute.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; Test authors should subclass TestCase for their own tests. Construction</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; and deconstruction of the test&#39;s environment (&#39;fixture&#39;) can be</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; implemented by overriding the &#39;setUp&#39; and &#39;tearDown&#39; methods respectively.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; If it is necessary to override the __init__ method, the base class</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; __init__ method must always be called. It is important that subclasses</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; should not change the signature of their __init__ method, since instances</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; of the classes are instantiated automatically by parts of the framework</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; in order to be run.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='com'># This attribute determines which exception will be raised when</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='com'># the instance&#39;s assertion methods fail; test methods raising this</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='com'># exception will be deemed to have &#39;failed&#39; rather than &#39;errored&#39;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>failureException</span> <span class='op'>=</span> <span class='nam'>AssertionError</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>methodName</span><span class='op'>=</span><span class='str'>&#39;runTest&#39;</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Create an instance of the class that will use the named test</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; method when executed. Raises a ValueError if the instance does</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; not have a method with the specified name.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_testMethodName</span> <span class='op'>=</span> <span class='nam'>methodName</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>testMethod</span> <span class='op'>=</span> <span class='nam'>getattr</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>methodName</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_testMethodDoc</span> <span class='op'>=</span> <span class='nam'>testMethod</span><span class='op'>.</span><span class='nam'>__doc__</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>AttributeError</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>ValueError</span><span class='op'>,</span> <span class='str'>&quot;no such test method in %s: %s&quot;</span> <span class='op'>%</span> <span class='xx'>\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>__class__</span><span class='op'>,</span> <span class='nam'>methodName</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Hook method for setting up the test fixture before exercising it.&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>pass</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Hook method for deconstructing the test fixture after testing it.&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>pass</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>countTestCases</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>defaultTestResult</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>TestResult</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>shortDescription</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Returns a one-line description of the test, or None if no</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; description has been provided.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The default implementation of this method returns the first line of</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; the specified test method&#39;s docstring.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>doc</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_testMethodDoc</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>doc</span> <span class='key'>and</span> <span class='nam'>doc</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>&quot;\n&quot;</span><span class='op'>)</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='key'>or</span> <span class='nam'>None</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>id</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&quot;%s.%s&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>_strclass</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>__class__</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_testMethodName</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__eq__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>type</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span> <span class='key'>is</span> <span class='key'>not</span> <span class='nam'>type</span><span class='op'>(</span><span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>False</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_testMethodName</span> <span class='op'>==</span> <span class='nam'>other</span><span class='op'>.</span><span class='nam'>_testMethodName</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__ne__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='key'>not</span> <span class='nam'>self</span> <span class='op'>==</span> <span class='nam'>other</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__hash__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>hash</span><span class='op'>(</span><span class='op'>(</span><span class='nam'>type</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_testMethodName</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__str__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&quot;%s (%s)&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>_testMethodName</span><span class='op'>,</span> <span class='nam'>_strclass</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>__class__</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__repr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&quot;&lt;%s testMethod=%s&gt;&quot;</span> <span class='op'>%</span> <span class='xx'>\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='op'>(</span><span class='nam'>_strclass</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>__class__</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_testMethodName</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>run</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>result</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>result</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span> <span class='nam'>result</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>defaultTestResult</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>result</span><span class='op'>.</span><span class='nam'>startTest</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>testMethod</span> <span class='op'>=</span> <span class='nam'>getattr</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_testMethodName</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>setUp</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>KeyboardInterrupt</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>result</span><span class='op'>.</span><span class='nam'>addError</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_exc_info</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>ok</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>testMethod</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>ok</span> <span class='op'>=</span> <span class='nam'>True</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>result</span><span class='op'>.</span><span class='nam'>addFailure</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_exc_info</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>KeyboardInterrupt</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>result</span><span class='op'>.</span><span class='nam'>addError</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_exc_info</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tearDown</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>KeyboardInterrupt</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>result</span><span class='op'>.</span><span class='nam'>addError</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_exc_info</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>ok</span> <span class='op'>=</span> <span class='nam'>False</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>ok</span><span class='op'>:</span> <span class='nam'>result</span><span class='op'>.</span><span class='nam'>addSuccess</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>result</span><span class='op'>.</span><span class='nam'>stopTest</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__call__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwds</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>run</span><span class='op'>(</span><span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwds</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>debug</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Run the test without collecting errors in a TestResult&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>setUp</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>getattr</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_testMethodName</span><span class='op'>)</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tearDown</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_exc_info</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Return a version of sys.exc_info() with the traceback frame</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; minimised; usually the top level of the traceback frame is not</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; needed.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exc_info</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>fail</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Fail immediately, with the given message.&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>,</span> <span class='nam'>msg</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>failIf</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>expr</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Fail the test if the expression is true.&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>expr</span><span class='op'>:</span> <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>,</span> <span class='nam'>msg</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>failUnless</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>expr</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Fail the test unless the expression is true.&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>expr</span><span class='op'>:</span> <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>,</span> <span class='nam'>msg</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>failUnlessRaises</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>excClass</span><span class='op'>,</span> <span class='nam'>callableObj</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwargs</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Fail unless an exception of class excClass is thrown</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; by callableObj when invoked with arguments args and keyword</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; arguments kwargs. If a different type of exception is</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; thrown, it will not be caught, and the test case will be</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; deemed to have suffered an error, exactly as for an</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; unexpected exception.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>callableObj</span><span class='op'>(</span><span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwargs</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>excClass</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>excClass</span><span class='op'>,</span><span class='str'>&#39;__name__&#39;</span><span class='op'>)</span><span class='op'>:</span> <span class='nam'>excName</span> <span class='op'>=</span> <span class='nam'>excClass</span><span class='op'>.</span><span class='nam'>__name__</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span> <span class='nam'>excName</span> <span class='op'>=</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>excClass</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>,</span> <span class='str'>&quot;%s not raised&quot;</span> <span class='op'>%</span> <span class='nam'>excName</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>failUnlessEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>first</span><span class='op'>,</span> <span class='nam'>second</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Fail if the two objects are unequal as determined by the &#39;==&#39;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; operator.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>349</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>first</span> <span class='op'>==</span> <span class='nam'>second</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>,</span> <span class='xx'>\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>(</span><span class='nam'>msg</span> <span class='key'>or</span> <span class='str'>&#39;%r != %r&#39;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>first</span><span class='op'>,</span> <span class='nam'>second</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>failIfEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>first</span><span class='op'>,</span> <span class='nam'>second</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Fail if the two objects are equal as determined by the &#39;==&#39;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; operator.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>first</span> <span class='op'>==</span> <span class='nam'>second</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>,</span> <span class='xx'>\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>(</span><span class='nam'>msg</span> <span class='key'>or</span> <span class='str'>&#39;%r == %r&#39;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>first</span><span class='op'>,</span> <span class='nam'>second</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>failUnlessAlmostEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>first</span><span class='op'>,</span> <span class='nam'>second</span><span class='op'>,</span> <span class='nam'>places</span><span class='op'>=</span><span class='num'>7</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Fail if the two objects are unequal as determined by their</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; difference rounded to the given number of decimal places</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; (default 7) and comparing to zero.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Note that decimal places (from zero) are usually not the same</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; as significant digits (measured from the most signficant digit).</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>round</span><span class='op'>(</span><span class='nam'>abs</span><span class='op'>(</span><span class='nam'>second</span><span class='op'>-</span><span class='nam'>first</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>places</span><span class='op'>)</span> <span class='op'>!=</span> <span class='num'>0</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>,</span> <span class='xx'>\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>(</span><span class='nam'>msg</span> <span class='key'>or</span> <span class='str'>&#39;%r != %r within %r places&#39;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>first</span><span class='op'>,</span> <span class='nam'>second</span><span class='op'>,</span> <span class='nam'>places</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>failIfAlmostEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>first</span><span class='op'>,</span> <span class='nam'>second</span><span class='op'>,</span> <span class='nam'>places</span><span class='op'>=</span><span class='num'>7</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Fail if the two objects are equal as determined by their</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; difference rounded to the given number of decimal places</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; (default 7) and comparing to zero.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Note that decimal places (from zero) are usually not the same</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; as significant digits (measured from the most signficant digit).</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>round</span><span class='op'>(</span><span class='nam'>abs</span><span class='op'>(</span><span class='nam'>second</span><span class='op'>-</span><span class='nam'>first</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>places</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>,</span> <span class='xx'>\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>(</span><span class='nam'>msg</span> <span class='key'>or</span> <span class='str'>&#39;%r == %r within %r places&#39;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>first</span><span class='op'>,</span> <span class='nam'>second</span><span class='op'>,</span> <span class='nam'>places</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='com'># Synonyms for assertion methods</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>assertEqual</span> <span class='op'>=</span> <span class='nam'>assertEquals</span> <span class='op'>=</span> <span class='nam'>failUnlessEqual</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>assertNotEqual</span> <span class='op'>=</span> <span class='nam'>assertNotEquals</span> <span class='op'>=</span> <span class='nam'>failIfEqual</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>assertAlmostEqual</span> <span class='op'>=</span> <span class='nam'>assertAlmostEquals</span> <span class='op'>=</span> <span class='nam'>failUnlessAlmostEqual</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>assertNotAlmostEqual</span> <span class='op'>=</span> <span class='nam'>assertNotAlmostEquals</span> <span class='op'>=</span> <span class='nam'>failIfAlmostEqual</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>assertRaises</span> <span class='op'>=</span> <span class='nam'>failUnlessRaises</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>assert_</span> <span class='op'>=</span> <span class='nam'>assertTrue</span> <span class='op'>=</span> <span class='nam'>failUnless</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>assertFalse</span> <span class='op'>=</span> <span class='nam'>failIf</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>TestSuite</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;A test suite is a composite test consisting of a number of TestCases.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; For use, create an instance of TestSuite, then add test case instances.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; When all tests have been added, the suite can be passed to a test</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; runner, such as TextTestRunner. It will run the individual test cases</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; in the order in which they were added, aggregating the results. When</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; subclassing, do not forget to call the base class constructor.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>tests</span><span class='op'>=</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_tests</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addTests</span><span class='op'>(</span><span class='nam'>tests</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__repr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&quot;&lt;%s tests=%s&gt;&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>_strclass</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>__class__</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_tests</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>__str__</span> <span class='op'>=</span> <span class='nam'>__repr__</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__eq__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>type</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span> <span class='key'>is</span> <span class='key'>not</span> <span class='nam'>type</span><span class='op'>(</span><span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>False</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_tests</span> <span class='op'>==</span> <span class='nam'>other</span><span class='op'>.</span><span class='nam'>_tests</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__ne__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='key'>not</span> <span class='nam'>self</span> <span class='op'>==</span> <span class='nam'>other</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='com'># Can&#39;t guarantee hash invariant, so flag as unhashable</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>__hash__</span> <span class='op'>=</span> <span class='nam'>None</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__iter__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>iter</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>_tests</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>countTestCases</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cases</span> <span class='op'>=</span> <span class='num'>0</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>test</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_tests</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cases</span> <span class='op'>+=</span> <span class='nam'>test</span><span class='op'>.</span><span class='nam'>countTestCases</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>cases</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>addTest</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># sanity checks</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>443</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>,</span> <span class='str'>&#39;__call__&#39;</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>TypeError</span><span class='op'>(</span><span class='str'>&quot;the test to add must be callable&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>446</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='op'>(</span><span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>type</span><span class='op'>,</span> <span class='nam'>types</span><span class='op'>.</span><span class='nam'>ClassType</span><span class='op'>)</span><span class='op'>)</span> <span class='key'>and</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>issubclass</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>,</span> <span class='nam'>TestSuite</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>TypeError</span><span class='op'>(</span><span class='str'>&quot;TestCases and TestSuites must be instantiated &quot;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;before passing them to addTest()&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_tests</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>addTests</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>tests</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>452</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>tests</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>TypeError</span><span class='op'>(</span><span class='str'>&quot;tests must be an iterable of tests, not a string&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>test</span> <span class='key'>in</span> <span class='nam'>tests</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addTest</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>run</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>result</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>test</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_tests</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>459</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>result</span><span class='op'>.</span><span class='nam'>shouldStop</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>break</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>test</span><span class='op'>(</span><span class='nam'>result</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>result</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__call__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwds</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>run</span><span class='op'>(</span><span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwds</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>debug</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Run the tests without collecting errors in a TestResult&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>test</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_tests</span><span class='op'>:</span> <span class='nam'>test</span><span class='op'>.</span><span class='nam'>debug</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>FunctionTestCase</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;A test case that wraps a test function.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; This is useful for slipping pre-existing test functions into the</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; unittest framework. Optionally, set-up and tidy-up functions can be</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; supplied. As with TestCase, the tidy-up (&#39;tearDown&#39;) function will</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; always be called if the set-up (&#39;setUp&#39;) function ran successfully.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>testFunc</span><span class='op'>,</span> <span class='nam'>setUp</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>tearDown</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>description</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestCase</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__setUpFunc</span> <span class='op'>=</span> <span class='nam'>setUp</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__tearDownFunc</span> <span class='op'>=</span> <span class='nam'>tearDown</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__testFunc</span> <span class='op'>=</span> <span class='nam'>testFunc</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__description</span> <span class='op'>=</span> <span class='nam'>description</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__setUpFunc</span> <span class='key'>is</span> <span class='key'>not</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__setUpFunc</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__tearDownFunc</span> <span class='key'>is</span> <span class='key'>not</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__tearDownFunc</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>runTest</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__testFunc</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>id</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__testFunc</span><span class='op'>.</span><span class='nam'>__name__</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__eq__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>type</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span> <span class='key'>is</span> <span class='key'>not</span> <span class='nam'>type</span><span class='op'>(</span><span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>False</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__setUpFunc</span> <span class='op'>==</span> <span class='nam'>other</span><span class='op'>.</span><span class='nam'>__setUpFunc</span> <span class='key'>and</span> <span class='xx'>\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__tearDownFunc</span> <span class='op'>==</span> <span class='nam'>other</span><span class='op'>.</span><span class='nam'>__tearDownFunc</span> <span class='key'>and</span> <span class='xx'>\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__testFunc</span> <span class='op'>==</span> <span class='nam'>other</span><span class='op'>.</span><span class='nam'>__testFunc</span> <span class='key'>and</span> <span class='xx'>\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__description</span> <span class='op'>==</span> <span class='nam'>other</span><span class='op'>.</span><span class='nam'>__description</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__ne__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='key'>not</span> <span class='nam'>self</span> <span class='op'>==</span> <span class='nam'>other</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__hash__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>hash</span><span class='op'>(</span><span class='op'>(</span><span class='nam'>type</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__setUpFunc</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__tearDownFunc</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__testFunc</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__description</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__str__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&quot;%s (%s)&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>_strclass</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>__class__</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__testFunc</span><span class='op'>.</span><span class='nam'>__name__</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__repr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&quot;&lt;%s testFunc=%s&gt;&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>_strclass</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>__class__</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__testFunc</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>shortDescription</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__description</span> <span class='key'>is</span> <span class='key'>not</span> <span class='nam'>None</span><span class='op'>:</span> <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__description</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>doc</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__testFunc</span><span class='op'>.</span><span class='nam'>__doc__</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>doc</span> <span class='key'>and</span> <span class='nam'>doc</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>&quot;\n&quot;</span><span class='op'>)</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='key'>or</span> <span class='nam'>None</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># Locating and loading tests</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>TestLoader</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;This class is responsible for loading tests according to various</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; criteria and returning them wrapped in a TestSuite</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>testMethodPrefix</span> <span class='op'>=</span> <span class='str'>&#39;test&#39;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>sortTestMethodsUsing</span> <span class='op'>=</span> <span class='nam'>cmp</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>suiteClass</span> <span class='op'>=</span> <span class='nam'>TestSuite</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>loadTestsFromTestCase</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>testCaseClass</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Return a suite of all tests cases contained in testCaseClass&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>546</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>issubclass</span><span class='op'>(</span><span class='nam'>testCaseClass</span><span class='op'>,</span> <span class='nam'>TestSuite</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>TypeError</span><span class='op'>(</span><span class='str'>&quot;Test cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>testCaseNames</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>getTestCaseNames</span><span class='op'>(</span><span class='nam'>testCaseClass</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>549</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>testCaseNames</span> <span class='key'>and</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>testCaseClass</span><span class='op'>,</span> <span class='str'>&#39;runTest&#39;</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>testCaseNames</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;runTest&#39;</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>suiteClass</span><span class='op'>(</span><span class='nam'>map</span><span class='op'>(</span><span class='nam'>testCaseClass</span><span class='op'>,</span> <span class='nam'>testCaseNames</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>loadTestsFromModule</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>module</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Return a suite of all tests cases contained in the given module&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>tests</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>name</span> <span class='key'>in</span> <span class='nam'>dir</span><span class='op'>(</span><span class='nam'>module</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>obj</span> <span class='op'>=</span> <span class='nam'>getattr</span><span class='op'>(</span><span class='nam'>module</span><span class='op'>,</span> <span class='nam'>name</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='op'>(</span><span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>type</span><span class='op'>,</span> <span class='nam'>types</span><span class='op'>.</span><span class='nam'>ClassType</span><span class='op'>)</span><span class='op'>)</span> <span class='key'>and</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>issubclass</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>tests</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>loadTestsFromTestCase</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>suiteClass</span><span class='op'>(</span><span class='nam'>tests</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>loadTestsFromName</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>name</span><span class='op'>,</span> <span class='nam'>module</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Return a suite of all tests cases given a string specifier.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The name may resolve either to a module, a test case class, a</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; test method within a test case class, or a callable object which</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; returns a TestCase or TestSuite instance.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The method optionally resolves the names relative to a given module.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parts</span> <span class='op'>=</span> <span class='nam'>name</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>&#39;.&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>module</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parts_copy</span> <span class='op'>=</span> <span class='nam'>parts</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>parts_copy</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>module</span> <span class='op'>=</span> <span class='nam'>__import__</span><span class='op'>(</span><span class='str'>&#39;.&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>parts_copy</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>break</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>ImportError</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>del</span> <span class='nam'>parts_copy</span><span class='op'>[</span><span class='op'>-</span><span class='num'>1</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>parts_copy</span><span class='op'>:</span> <span class='key'>raise</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parts</span> <span class='op'>=</span> <span class='nam'>parts</span><span class='op'>[</span><span class='num'>1</span><span class='op'>:</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>obj</span> <span class='op'>=</span> <span class='nam'>module</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>part</span> <span class='key'>in</span> <span class='nam'>parts</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parent</span><span class='op'>,</span> <span class='nam'>obj</span> <span class='op'>=</span> <span class='nam'>obj</span><span class='op'>,</span> <span class='nam'>getattr</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='nam'>part</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>type</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>)</span> <span class='op'>==</span> <span class='nam'>types</span><span class='op'>.</span><span class='nam'>ModuleType</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>loadTestsFromModule</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='op'>(</span><span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>type</span><span class='op'>,</span> <span class='nam'>types</span><span class='op'>.</span><span class='nam'>ClassType</span><span class='op'>)</span><span class='op'>)</span> <span class='key'>and</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>issubclass</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>loadTestsFromTestCase</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='op'>(</span><span class='nam'>type</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>)</span> <span class='op'>==</span> <span class='nam'>types</span><span class='op'>.</span><span class='nam'>UnboundMethodType</span> <span class='key'>and</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>parent</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>type</span><span class='op'>,</span> <span class='nam'>types</span><span class='op'>.</span><span class='nam'>ClassType</span><span class='op'>)</span><span class='op'>)</span> <span class='key'>and</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>issubclass</span><span class='op'>(</span><span class='nam'>parent</span><span class='op'>,</span> <span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>TestSuite</span><span class='op'>(</span><span class='op'>[</span><span class='nam'>parent</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>.</span><span class='nam'>__name__</span><span class='op'>)</span><span class='op'>]</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='nam'>TestSuite</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>obj</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='str'>&#39;__call__&#39;</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>test</span> <span class='op'>=</span> <span class='nam'>obj</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>,</span> <span class='nam'>TestSuite</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>test</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>,</span> <span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>TestSuite</span><span class='op'>(</span><span class='op'>[</span><span class='nam'>test</span><span class='op'>]</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>TypeError</span><span class='op'>(</span><span class='str'>&quot;calling %s returned %s, not a test&quot;</span> <span class='op'>%</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>(</span><span class='nam'>obj</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>TypeError</span><span class='op'>(</span><span class='str'>&quot;don&#39;t know how to make test from: %s&quot;</span> <span class='op'>%</span> <span class='nam'>obj</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>loadTestsFromNames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>names</span><span class='op'>,</span> <span class='nam'>module</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Return a suite of all tests cases found using the given sequence</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; of string specifiers. See &#39;loadTestsFromName()&#39;.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>suites</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>loadTestsFromName</span><span class='op'>(</span><span class='nam'>name</span><span class='op'>,</span> <span class='nam'>module</span><span class='op'>)</span> <span class='key'>for</span> <span class='nam'>name</span> <span class='key'>in</span> <span class='nam'>names</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>suiteClass</span><span class='op'>(</span><span class='nam'>suites</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>getTestCaseNames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>testCaseClass</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Return a sorted sequence of method names found within testCaseClass</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>isTestMethod</span><span class='op'>(</span><span class='nam'>attrname</span><span class='op'>,</span> <span class='nam'>testCaseClass</span><span class='op'>=</span><span class='nam'>testCaseClass</span><span class='op'>,</span> <span class='nam'>prefix</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testMethodPrefix</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>attrname</span><span class='op'>.</span><span class='nam'>startswith</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>)</span> <span class='key'>and</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>getattr</span><span class='op'>(</span><span class='nam'>testCaseClass</span><span class='op'>,</span> <span class='nam'>attrname</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;__call__&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>testFnNames</span> <span class='op'>=</span> <span class='nam'>filter</span><span class='op'>(</span><span class='nam'>isTestMethod</span><span class='op'>,</span> <span class='nam'>dir</span><span class='op'>(</span><span class='nam'>testCaseClass</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>624</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sortTestMethodsUsing</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>testFnNames</span><span class='op'>.</span><span class='nam'>sort</span><span class='op'>(</span><span class='nam'>key</span><span class='op'>=</span><span class='nam'>_CmpToKey</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>sortTestMethodsUsing</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>testFnNames</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>defaultTestLoader</span> <span class='op'>=</span> <span class='nam'>TestLoader</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># Patches for old functions: these functions should be considered obsolete</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>_makeLoader</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>,</span> <span class='nam'>sortUsing</span><span class='op'>,</span> <span class='nam'>suiteClass</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='nam'>loader</span> <span class='op'>=</span> <span class='nam'>TestLoader</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='nam'>loader</span><span class='op'>.</span><span class='nam'>sortTestMethodsUsing</span> <span class='op'>=</span> <span class='nam'>sortUsing</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='nam'>loader</span><span class='op'>.</span><span class='nam'>testMethodPrefix</span> <span class='op'>=</span> <span class='nam'>prefix</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>suiteClass</span><span class='op'>:</span> <span class='nam'>loader</span><span class='op'>.</span><span class='nam'>suiteClass</span> <span class='op'>=</span> <span class='nam'>suiteClass</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>loader</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>getTestCaseNames</span><span class='op'>(</span><span class='nam'>testCaseClass</span><span class='op'>,</span> <span class='nam'>prefix</span><span class='op'>,</span> <span class='nam'>sortUsing</span><span class='op'>=</span><span class='nam'>cmp</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>_makeLoader</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>,</span> <span class='nam'>sortUsing</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>getTestCaseNames</span><span class='op'>(</span><span class='nam'>testCaseClass</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>makeSuite</span><span class='op'>(</span><span class='nam'>testCaseClass</span><span class='op'>,</span> <span class='nam'>prefix</span><span class='op'>=</span><span class='str'>&#39;test&#39;</span><span class='op'>,</span> <span class='nam'>sortUsing</span><span class='op'>=</span><span class='nam'>cmp</span><span class='op'>,</span> <span class='nam'>suiteClass</span><span class='op'>=</span><span class='nam'>TestSuite</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>_makeLoader</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>,</span> <span class='nam'>sortUsing</span><span class='op'>,</span> <span class='nam'>suiteClass</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>loadTestsFromTestCase</span><span class='op'>(</span><span class='nam'>testCaseClass</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>findTestCases</span><span class='op'>(</span><span class='nam'>module</span><span class='op'>,</span> <span class='nam'>prefix</span><span class='op'>=</span><span class='str'>&#39;test&#39;</span><span class='op'>,</span> <span class='nam'>sortUsing</span><span class='op'>=</span><span class='nam'>cmp</span><span class='op'>,</span> <span class='nam'>suiteClass</span><span class='op'>=</span><span class='nam'>TestSuite</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>_makeLoader</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>,</span> <span class='nam'>sortUsing</span><span class='op'>,</span> <span class='nam'>suiteClass</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>loadTestsFromModule</span><span class='op'>(</span><span class='nam'>module</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># Text UI</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>_WritelnDecorator</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Used to decorate file-like objects with a handy &#39;writeln&#39; method&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span><span class='nam'>stream</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span> <span class='op'>=</span> <span class='nam'>stream</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__getattr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>attr</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>getattr</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>,</span><span class='nam'>attr</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>writeln</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>arg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>arg</span><span class='op'>:</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>arg</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='str'>&#39;\n&#39;</span><span class='op'>)</span> <span class='com'># text-mode streams translate to \r\n if needed</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>_TextTestResult</span><span class='op'>(</span><span class='nam'>TestResult</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;A test result class that can print formatted text results to a stream.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; Used by TextTestRunner.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>separator1</span> <span class='op'>=</span> <span class='str'>&#39;=&#39;</span> <span class='op'>*</span> <span class='num'>70</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>separator2</span> <span class='op'>=</span> <span class='str'>&#39;-&#39;</span> <span class='op'>*</span> <span class='num'>70</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>stream</span><span class='op'>,</span> <span class='nam'>descriptions</span><span class='op'>,</span> <span class='nam'>verbosity</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestResult</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span> <span class='op'>=</span> <span class='nam'>stream</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>showAll</span> <span class='op'>=</span> <span class='nam'>verbosity</span> <span class='op'>&gt;</span> <span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>dots</span> <span class='op'>=</span> <span class='nam'>verbosity</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>descriptions</span> <span class='op'>=</span> <span class='nam'>descriptions</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>getDescription</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>688</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>descriptions</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>test</span><span class='op'>.</span><span class='nam'>shortDescription</span><span class='op'>(</span><span class='op'>)</span> <span class='key'>or</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>startTest</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestResult</span><span class='op'>.</span><span class='nam'>startTest</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>showAll</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>getDescription</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='str'>&quot; ... &quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>flush</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>addSuccess</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestResult</span><span class='op'>.</span><span class='nam'>addSuccess</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>701</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>showAll</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='str'>&quot;ok&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>dots</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='str'>&#39;.&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>flush</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>addError</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestResult</span><span class='op'>.</span><span class='nam'>addError</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>showAll</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='str'>&quot;ERROR&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>dots</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='str'>&#39;E&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>flush</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>addFailure</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestResult</span><span class='op'>.</span><span class='nam'>addFailure</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>showAll</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='str'>&quot;FAIL&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>dots</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='str'>&#39;F&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>flush</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>printErrors</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>724</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>dots</span> <span class='key'>or</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>showAll</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>printErrorList</span><span class='op'>(</span><span class='str'>&#39;ERROR&#39;</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>errors</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>printErrorList</span><span class='op'>(</span><span class='str'>&#39;FAIL&#39;</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failures</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>printErrorList</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>flavour</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>729</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>test</span><span class='op'>,</span> <span class='nam'>err</span> <span class='key'>in</span> <span class='nam'>errors</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>separator1</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='str'>&quot;%s: %s&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>flavour</span><span class='op'>,</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>getDescription</span><span class='op'>(</span><span class='nam'>test</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>separator2</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='str'>&quot;%s&quot;</span> <span class='op'>%</span> <span class='nam'>err</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>TextTestRunner</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;A test runner class that displays results in textual form.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; It prints out the names of tests as they are run, errors as they</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; occur, and a summary of the results at the end of the test run.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>stream</span><span class='op'>=</span><span class='nam'>sys</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='nam'>descriptions</span><span class='op'>=</span><span class='num'>1</span><span class='op'>,</span> <span class='nam'>verbosity</span><span class='op'>=</span><span class='num'>1</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span> <span class='op'>=</span> <span class='nam'>_WritelnDecorator</span><span class='op'>(</span><span class='nam'>stream</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>descriptions</span> <span class='op'>=</span> <span class='nam'>descriptions</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>verbosity</span> <span class='op'>=</span> <span class='nam'>verbosity</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_makeResult</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>_TextTestResult</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>descriptions</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>verbosity</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>run</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>test</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Run the given test case or test suite.&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>result</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>_makeResult</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>startTime</span> <span class='op'>=</span> <span class='nam'>time</span><span class='op'>.</span><span class='nam'>time</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>test</span><span class='op'>(</span><span class='nam'>result</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>stopTime</span> <span class='op'>=</span> <span class='nam'>time</span><span class='op'>.</span><span class='nam'>time</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>timeTaken</span> <span class='op'>=</span> <span class='nam'>stopTime</span> <span class='op'>-</span> <span class='nam'>startTime</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>result</span><span class='op'>.</span><span class='nam'>printErrors</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='nam'>result</span><span class='op'>.</span><span class='nam'>separator2</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>run</span> <span class='op'>=</span> <span class='nam'>result</span><span class='op'>.</span><span class='nam'>testsRun</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='str'>&quot;Ran %d test%s in %.3fs&quot;</span> <span class='op'>%</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>(</span><span class='nam'>run</span><span class='op'>,</span> <span class='nam'>run</span> <span class='op'>!=</span> <span class='num'>1</span> <span class='key'>and</span> <span class='str'>&quot;s&quot;</span> <span class='key'>or</span> <span class='str'>&quot;&quot;</span><span class='op'>,</span> <span class='nam'>timeTaken</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>763</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>result</span><span class='op'>.</span><span class='nam'>wasSuccessful</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='str'>&quot;FAILED (&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>failed</span><span class='op'>,</span> <span class='nam'>errored</span> <span class='op'>=</span> <span class='nam'>map</span><span class='op'>(</span><span class='nam'>len</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>result</span><span class='op'>.</span><span class='nam'>failures</span><span class='op'>,</span> <span class='nam'>result</span><span class='op'>.</span><span class='nam'>errors</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>failed</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='str'>&quot;failures=%d&quot;</span> <span class='op'>%</span> <span class='nam'>failed</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>errored</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>failed</span><span class='op'>:</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='str'>&quot;, &quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='str'>&quot;errors=%d&quot;</span> <span class='op'>%</span> <span class='nam'>errored</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='str'>&quot;)&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stream</span><span class='op'>.</span><span class='nam'>writeln</span><span class='op'>(</span><span class='str'>&quot;OK&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>result</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># Facilities for running tests from the command line</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>class</span> <span class='nam'>TestProgram</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;A command-line program that runs a set of tests; this is primarily</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp;&nbsp; for making test modules conveniently executable.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>USAGE</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>Usage: %(progName)s [options] [test] [...]</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>Options:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; -h, --help&nbsp; &nbsp; &nbsp;&nbsp; Show this message</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; -v, --verbose&nbsp; &nbsp; Verbose output</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; -q, --quiet&nbsp; &nbsp; &nbsp; Minimal output</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>Examples:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; %(progName)s&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; - run default set of tests</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; %(progName)s MyTestSuite&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; - run suite &#39;MyTestSuite&#39;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; %(progName)s MyTestCase.testSomething&nbsp; &nbsp; &nbsp; - run MyTestCase.testSomething</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; %(progName)s MyTestCase&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - run all &#39;test*&#39; test methods</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; in MyTestCase</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>module</span><span class='op'>=</span><span class='str'>&#39;__main__&#39;</span><span class='op'>,</span> <span class='nam'>defaultTest</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>argv</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>testRunner</span><span class='op'>=</span><span class='nam'>TextTestRunner</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>testLoader</span><span class='op'>=</span><span class='nam'>defaultTestLoader</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>808</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>type</span><span class='op'>(</span><span class='nam'>module</span><span class='op'>)</span> <span class='op'>==</span> <span class='nam'>type</span><span class='op'>(</span><span class='str'>&#39;&#39;</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>module</span> <span class='op'>=</span> <span class='nam'>__import__</span><span class='op'>(</span><span class='nam'>module</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>806</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>part</span> <span class='key'>in</span> <span class='nam'>module</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>&#39;.&#39;</span><span class='op'>)</span><span class='op'>[</span><span class='num'>1</span><span class='op'>:</span><span class='op'>]</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>module</span> <span class='op'>=</span> <span class='nam'>getattr</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>module</span><span class='op'>,</span> <span class='nam'>part</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>module</span> <span class='op'>=</span> <span class='nam'>module</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>810</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>argv</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>argv</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>argv</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>verbosity</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>defaultTest</span> <span class='op'>=</span> <span class='nam'>defaultTest</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testRunner</span> <span class='op'>=</span> <span class='nam'>testRunner</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testLoader</span> <span class='op'>=</span> <span class='nam'>testLoader</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>progName</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>basename</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>runTests</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>usageExit</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>msg</span><span class='op'>:</span> <span class='key'>print</span> <span class='nam'>msg</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>USAGE</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__dict__</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='num'>2</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>argv</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>import</span> <span class='nam'>getopt</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>options</span><span class='op'>,</span> <span class='nam'>args</span> <span class='op'>=</span> <span class='nam'>getopt</span><span class='op'>.</span><span class='nam'>getopt</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>[</span><span class='num'>1</span><span class='op'>:</span><span class='op'>]</span><span class='op'>,</span> <span class='str'>&#39;hHvq&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>[</span><span class='str'>&#39;help&#39;</span><span class='op'>,</span><span class='str'>&#39;verbose&#39;</span><span class='op'>,</span><span class='str'>&#39;quiet&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>opt</span><span class='op'>,</span> <span class='nam'>value</span> <span class='key'>in</span> <span class='nam'>options</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>831</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opt</span> <span class='key'>in</span> <span class='op'>(</span><span class='str'>&#39;-h&#39;</span><span class='op'>,</span><span class='str'>&#39;-H&#39;</span><span class='op'>,</span><span class='str'>&#39;--help&#39;</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>usageExit</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>833</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opt</span> <span class='key'>in</span> <span class='op'>(</span><span class='str'>&#39;-q&#39;</span><span class='op'>,</span><span class='str'>&#39;--quiet&#39;</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>verbosity</span> <span class='op'>=</span> <span class='num'>0</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>829</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opt</span> <span class='key'>in</span> <span class='op'>(</span><span class='str'>&#39;-v&#39;</span><span class='op'>,</span><span class='str'>&#39;--verbose&#39;</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>verbosity</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>839</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>defaultTest</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>test</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testLoader</span><span class='op'>.</span><span class='nam'>loadTestsFromModule</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>module</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>)</span> <span class='op'>&gt;</span> <span class='num'>0</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testNames</span> <span class='op'>=</span> <span class='nam'>args</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testNames</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>defaultTest</span><span class='op'>,</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>createTests</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>getopt</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>usageExit</span><span class='op'>(</span><span class='nam'>msg</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>createTests</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>test</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testLoader</span><span class='op'>.</span><span class='nam'>loadTestsFromNames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testNames</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>module</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>runTests</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>860</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testRunner</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>type</span><span class='op'>,</span> <span class='nam'>types</span><span class='op'>.</span><span class='nam'>ClassType</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>testRunner</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testRunner</span><span class='op'>(</span><span class='nam'>verbosity</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>verbosity</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>TypeError</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># didn&#39;t accept the verbosity argument</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>testRunner</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testRunner</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># it is assumed to be a TestRunner instance</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>testRunner</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testRunner</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>result</span> <span class='op'>=</span> <span class='nam'>testRunner</span><span class='op'>.</span><span class='nam'>run</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>test</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='key'>not</span> <span class='nam'>result</span><span class='op'>.</span><span class='nam'>wasSuccessful</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>main</span> <span class='op'>=</span> <span class='nam'>TestProgram</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># Executing this module from the command line</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'>##############################################################################</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>872</span><span class='key'>if</span> <span class='nam'>__name__</span> <span class='op'>==</span> <span class='str'>&quot;__main__&quot;</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='nam'>main</span><span class='op'>(</span><span class='nam'>module</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
    
</td>
</tr>
</table>
</div>

</body>
</html>
